﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace GroceryPriceBook.Core.ViewModel
{
	public class Product
	{
		public Product()
		{
			PurchaseLogItems = new List<PurchaseLogItem>();
		}

		public System.Guid Id { get; set; }
		public Guid? ProductManufacturerId { get; set; }
		public Guid? CategoryId { get; set; }
		public Guid? AmountUnitId { get; set; }
		public Guid? QuantityUnitId { get; set; }

		[DisplayName("Active?")]
		public bool IsActive { get; set; }

		[Required(ErrorMessage = "Required")]
		[StringLength(200)]
		public string Name { get; set; }

		[Range(1, int.MaxValue, ErrorMessage = "Please enter a valid number")]
		[Required(ErrorMessage = "Required")]
		public int? Amount { get; set; }

		[Range(1, int.MaxValue, ErrorMessage = "Please enter a valid number")]
		[Required(ErrorMessage = "Required")]
		public int? Quantity { get; set; }

		public ProductManufacturer ProductManufacturer { get; set; }
		public ProductCategory ProductCategory { get; set; }
		public ProductAmountUnit ProductAmountUnit { get; set; }
		public ProductQuantityUnit ProductQuantityUnit { get; set; }

		public IEnumerable<SelectListItem> ProductCategorySelectListItems { get; set; }
		public IEnumerable<SelectListItem> ProductManufacfurerSelectListItems { get; set; }
		public IEnumerable<SelectListItem> ProductAmountUnitSelectListItems { get; set; }
		public IEnumerable<SelectListItem> ProductQuantityUnitSelectListItems { get; set; }
		public List<PurchaseLogItem> PurchaseLogItems { get; set; }
	}
}
